package com.neuedu.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.neuedu.config.LocalDateTimeDeserialized;
import lombok.*;

/**
 * <p>
 * 处方表
 * </p>
 *
 * @author LiYang
 * @since 2024-11-19
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Prescription implements Serializable {

    private static final long serialVersionUID = 1L;

    public Prescription(Integer id, String drugState) {
        this.id = id;
        this.drugState = drugState;
    }

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 挂号id
     */
    private Integer registerId;

    /**
     * 药品id
     */
    private Integer drugId;

    /**
     * 用法用量和频次
     */
    private String drugUsage;

    /**
     * 数量
     */
    private Integer drugNumber;

    /**
     * 开立时间
     */
    //@JSONField(deserializeUsing = LocalDateTimeDeserialized.class) // 使用自定义的日期反序列化器
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 指定日期格式
    private LocalDateTime creationTime;

    /**
     * 状态(已开立、已缴费、已发药、已退药、已退费)
     */
    private String drugState;
    /**
     * 药品信息
     */
    @TableField(exist = false)
    private DrugInfo drugInfo;
}
